home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Demos / Codeworks 0.94b3 / Codeworks® WWW Demo Doc. / Scripting Manual.doc / Scripting Manual.doc.rsrc / TEXT_130.txt < prev    next >
Encoding:
Text File  |  1995-05-01  |  2.3 KB  |  40 lines

  1. Simple Expressions
  2.  
  3.     Scripts are made up of smaller units called expressions.  Expressions are small bits of code that, when run, have a value.  For example, the following expressions yield these results:
  4.     
  5.  Expression        Ô¨Å Result, Remarks
  6.     3.14159    Ô¨Å 3.14159    a number is a simple expression
  7.     "Hello"    Ô¨Å "Hello"    so is a string of characters in quotes
  8.     3 + 4    Ô¨Å 7        arithmetic expression
  9.     3 + 4 * 5    Ô¨Å 23        follows normal math rules 
  10.     "abc" & "def"    Ô¨Å "abcdef"    & is a string operator
  11.     "abc" @ 2    Ô¨Å "b"        the second character of the string
  12.     3 < 4    Ô¨Å true    comparison of two numbers
  13.  
  14.  
  15. Trying the Examples
  16.     You can try these expressions out for yourself using the system.  We suggest that you create a Glyphic Codeworks document in your notebook for use just with this manual.  After you create the document, turn to it and open a new workspace.  When you are ready to take a break from the manual, simply turn back to the table of contents of the notebook.  Don‚Äôt close the workspace or other windows.  When you turn back to the document, they will still be open.
  17.  
  18.  
  19.     To open a new workspace:
  20. 1.    Create a new Codeworks document in your notebook and turn to it.  Use the ‚ÄòCodeworks, Folders‚Äô stationary.
  21. 2.    Tap on New Workspace‚Ķ from the Utilities menu.  A new workspace appears.
  22.  
  23.  
  24.     To execute and expression in a workspace:
  25. 1.    Enter the expression in the text editor portion of the workspace.  Pay close attention to the formatting and punctuation of the expression: computers are very fussy.
  26. 2.    Select the expression. 
  27. 3.    Tap Save at the top of the workspace.  The result of the operation appears to the right of the ‚Äòresult‚Äô entry in list at the top half of the workspace.  If it is not visible, then scroll the list so it is.
  28.  
  29.  
  30. Multiple Expressions
  31.     You can execute more than one expression at a time.  To do this, the expressions must end periods.  Each expression is executed in turn, and the result of only the last expression is the result of executing the whole group.  Consider:
  32.  
  33.         3 + 4.
  34.         1 / 5.
  35.         "Hello".
  36.  
  37.     When all three lines are selected and executed, first the system computes the number 7, then the number 0.2, and finally the string "Hello" which is the result.
  38.  
  39. ¬ª    Multiple Expressions don‚Äôt have to be on separate lines, only separated by periods.  The final period is optional.
  40.